package com.example.springbott.controller;

import com.example.springbott.aspactJ.OperationName;
import com.example.springbott.bean.BaseRespVo;
import com.example.springbott.bean.common.StatUserVO;
import com.example.springbott.service.AdminStatService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 1784549954@qq.com
 * @since 2022/11/20 16:51
 */
@RestController
@RequestMapping("admin/stat")
public class AdminStatController {
    @Autowired
    AdminStatService adminStatService;

    /**
     * http://localhost:8083/admin/stat/user
     * 用户统计
     * @return com.example.springbott.bean.BaseRespVo
     * @author heheer
     * @since 2022/11/20 16:54 
     */

    @RequiresPermissions("admin:stat:user")
    @RequestMapping("user")
    @OperationName("1")
    public BaseRespVo AdminStartUser(){
        StatUserVO statUserVO = adminStatService.statUser();
        return BaseRespVo.ok(statUserVO);
    }


    /**
     * http://localhost:8083/admin/stat/order
     * 订单统计
     * @return com.example.springbott.bean.BaseRespVo
     * @author heheer
     * @since 2022/11/20 20:00
     */
    @RequiresPermissions("admin:stat:order")
    @RequestMapping("order")
    @OperationName("1")
    public BaseRespVo AdminStatOrder(){
        StatUserVO statOrder = adminStatService.statOrder();
        return BaseRespVo.ok(statOrder);

    }

    /**
     * http://localhost:8083/admin/stat/goods
     * 商品统计
     * @return com.example.springbott.bean.BaseRespVo
     * @author heheer
     * @since 2022/11/20 20:01 
     */
    @RequiresPermissions("admin:stat:goods")
    @RequestMapping("goods")
    @OperationName("1")
    public BaseRespVo AdminStatGoods(){
        StatUserVO statOrder = adminStatService.statGoods();
        return BaseRespVo.ok(statOrder);
    }
}
